package cn.controller;

import cn.bean.MqEvent;
import cn.bean.Test;
import cn.hutool.json.JSONUtil;
import cn.mq.service.MqService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 测试controller
 *
 * @author zhanghui145
 * @date 2022/1/14 9:32
 * @since 1.0.0
 */
@RestController
public class MqController {

    @Resource
    private MqService mqService;

    static String str = JSONUtil.toJsonStr(Test.init());

    @GetMapping("/test")
    public void sendMq() {
        mqService.send(MqEvent.MQ_ONCE.getCode(), str);
        System.out.println("send success..." );
    }
}
